﻿<UserControl x:Class="VH.View.UpdateCustomerRepairStatusView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:resources="clr-namespace:VH.Resources;assembly=VH.Resources"
             xmlns:controls="clr-namespace:VH.UI.UserControls.Controls;assembly=VH.UI.UserControls"
             xmlns:view="clr-namespace:VH.View" xmlns:converters="clr-namespace:VH.View.Converters"
             mc:Ignorable="d">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="6" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="10" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="10" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="4" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <controls:VHLabel
            AddEndingPunctuation="True"
            Content="{x:Static  resources:LabelResources.RepairStatus}" />
        <ComboBox
            x:Name="cmbRepairStatus"
            Grid.Row="0"
            Grid.Column="2"
            Width="180"
            HorizontalAlignment="Left"
            SelectedValue="{Binding Entity.RepairStatus, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
            view:VHAttachedProperties.BindEnumToItemSource="VH.Model.RepairStatus, VH.Model" />

        <controls:VHLabel
            Grid.Row="2"
            AddEndingPunctuation="True"
            Content="{x:Static  resources:LabelResources.DispatchedToCompanyDate}"
            Visibility="{Binding Entity.RepairStatus,  Mode=OneWay, Converter={converters:VisibilityByRepairStatusConverter StatusParameter=DispatchedToCompany}}" />
        <DatePicker
            Grid.Row="2"
            Grid.Column="2"
            HorizontalAlignment="Left"
            SelectedDate="{Binding Entity.DispatchedToCompanyDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
            Validation.ErrorTemplate="{DynamicResource errorTemplateSilverlightStyle}"
            Width="150"
            Visibility="{Binding Entity.RepairStatus, Mode=OneWay,Converter={converters:VisibilityByRepairStatusConverter StatusParameter=DispatchedToCompany}}" />

        <controls:VHLabel
            Grid.Row="3"
            AddEndingPunctuation="True"
            Content="{x:Static  resources:LabelResources.CompanyReceivedDate}"
            Visibility="{Binding Entity.RepairStatus, Mode=OneWay,Converter={converters:VisibilityByRepairStatusConverter StatusParameter=CompanyReceived}}" />
        <DatePicker
            Grid.Row="3"
            Grid.Column="2"
            HorizontalAlignment="Left"
            SelectedDate="{Binding Entity.CompanyReceivedDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
            Validation.ErrorTemplate="{DynamicResource errorTemplateSilverlightStyle}"
            Width="150"
            Visibility="{Binding Entity.RepairStatus, Mode=OneWay,Converter={converters:VisibilityByRepairStatusConverter StatusParameter=CompanyReceived}}" />

        <controls:VHLabel
            Grid.Row="4"
            AddEndingPunctuation="True"
            Content="{x:Static  resources:LabelResources.CompanyDispatcedDate}"
            Visibility="{Binding Entity.RepairStatus, Mode=OneWay,Converter={converters:VisibilityByRepairStatusConverter StatusParameter=CompanyDispatched}}" />
        <DatePicker
            Grid.Row="4"
            Grid.Column="2"
            HorizontalAlignment="Left"
            SelectedDate="{Binding Entity.CompanyDispatchedDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
            Validation.ErrorTemplate="{DynamicResource errorTemplateSilverlightStyle}"
            Width="150"
            Visibility="{Binding Entity.RepairStatus, Mode=OneWay,Converter={converters:VisibilityByRepairStatusConverter StatusParameter=CompanyDispatched}}" />

        <controls:VHLabel
            Grid.Row="5"
            AddEndingPunctuation="True"
            Content="{x:Static  resources:LabelResources.VHReceivedDate}"
            Visibility="{Binding Entity.RepairStatus, Mode=OneWay,Converter={converters:VisibilityByRepairStatusConverter StatusParameter=Received}}" />
        <DatePicker
            Grid.Row="5"
            Grid.Column="2"
            HorizontalAlignment="Left"
            SelectedDate="{Binding Entity.VHReceivedDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
            Validation.ErrorTemplate="{DynamicResource errorTemplateSilverlightStyle}"
            Width="150"
            Visibility="{Binding Entity.RepairStatus, Mode=OneWay,Converter={converters:VisibilityByRepairStatusConverter StatusParameter=Received}}" />

        <controls:VHLabel
            Grid.Row="6"
            AddEndingPunctuation="True"
            Content="{x:Static  resources:LabelResources.DeliveredToCustomerDate}"
            Visibility="{Binding Entity.RepairStatus, Mode=OneWay,Converter={converters:VisibilityByRepairStatusConverter StatusParameter=DeliveredToCustomer}}" />
        <DatePicker
            Grid.Row="6"
            Grid.Column="2"
            HorizontalAlignment="Left"
            SelectedDate="{Binding Entity.DeliveredToCustomerDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
            Validation.ErrorTemplate="{DynamicResource errorTemplateSilverlightStyle}"
            Width="150"
            Visibility="{Binding Entity.RepairStatus, Mode=OneWay,Converter={converters:VisibilityByRepairStatusConverter StatusParameter=DeliveredToCustomer}}" />
        <CheckBox
             Grid.Row="7"
             Grid.ColumnSpan="2"
            Margin="4"
            Content="{x:Static  resources:LabelResources.SpareAidReceived}"
            IsChecked="{Binding Entity.IsSpareAidReceived, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
            Visibility="{Binding Entity.RepairStatus, Mode=OneWay,Converter={converters:VisibilityByRepairStatusConverter StatusParameter=DeliveredToCustomer}}" />

        <controls:VHLabel
            Grid.Row="8"
            AddEndingPunctuation="True"
            Content="{x:Static  resources:LabelResources.InformedDate}"
            Visibility="{Binding Entity.RepairStatus, Mode=OneWay,Converter={converters:VisibilityByRepairStatusConverter StatusParameter=Informed}}" />
        <DatePicker
            Grid.Row="8"
            Grid.Column="2"
            HorizontalAlignment="Left"
            SelectedDate="{Binding Entity.InformedDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
            Validation.ErrorTemplate="{DynamicResource errorTemplateSilverlightStyle}"
            Width="150"
            Visibility="{Binding Entity.RepairStatus, Mode=OneWay,Converter={converters:VisibilityByRepairStatusConverter StatusParameter=Informed}}" />

        <controls:VHLabel
                                Grid.Row="10"
                                Content="{x:Static  resources:LabelResources.AdditionalComment}" />
        <TextBox
                        Grid.Row="10"
                         Grid.Column="2"
                                    Text="{Binding Entity.AdditionalComment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                                    HorizontalAlignment="Left"
                                    Width="180"
                                    TextWrapping="WrapWithOverflow"
                                    AcceptsReturn="True" VerticalContentAlignment="Top" Height="80" />

        <Grid
            HorizontalAlignment="Center"
            Grid.ColumnSpan="3"
            Grid.Row="12"
            Margin="0,18,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="10" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Button
                Content="{x:Static  resources:ButtonResources.Save}"
                Command="{Binding SaveCommand}" />
            <Button
                Content="{x:Static  resources:ButtonResources.Cancel}"
                Grid.Column="2"
                Command="{Binding CancelCommand}" />
        </Grid>
    </Grid>
</UserControl>
